<?php

class Halls_Thumb_UploadSuccessView extends SrsHallsBaseView
{
	public function executeJson(AgaviRequestDataHolder $rd)
	{
    $image = $this->getAttribute('image');
    $hall  = $this->getAttribute('hall');
    
    $dir  = AgaviConfig::get('core.uploads_dir') . '/halls/' . $hall->id;
    $path = AgaviConfig::get('app.path') . '/uploads/halls/' . $hall->id . '/';

    $thumbInfo = getimagesize($dir . '/thumb_' . $image);
    $imageInfo = getimagesize($dir . '/' . $image);

    $result = array(
      'thumb'     => $path . 'thumb_' . $image,
      'thumbSize' => $thumbInfo[3],
      'image'     => $path . $image,
      'width'     => $imageInfo[0],
      'height'    => $imageInfo[1]
    );

    return json_encode($result);
	}
}